﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System;

namespace Fulcrum.ViewModelGenerator
{
    public class ViewModelGenerationDataContext : GenerationDataContext
    {
        public override string Name
        {
            get { return this.ViewModel.Name; }
        }

        public override string TemplateFileName
        {
            get { return "ViewModel.t4"; }
        }

        public override string OutputFileName
        {
            get 
            {
                return String.Format("{0}.Generated", this.ViewModel.Name); 
            }
        }

        public IViewModelCollectionConfig Collection
        {
            get;
            private set;
        }

        public IViewModelConfiguration ViewModel
        {
            get;
            private set;
        }

        internal ViewModelGenerationDataContext(IViewModelCollectionConfig collectionConfig, IViewModelConfiguration viewModel)
        {
            if (null == collectionConfig)
            {
                throw new ArgumentNullException("collectionConfig");
            }

            if (null == viewModel)
            {
                throw new ArgumentNullException("viewModel");
            }

            this.Collection = collectionConfig;
            this.ViewModel = viewModel;
        }

        public override string OutputPath
        {
            get
            {
                return this.ViewModel.Location;
            }
        }
    }
}
